<?php


namespace app\services;


use app\models\AdminAccount;

class AdminAccountsService extends Services {
    protected $limit;
    protected $pageSize;
    protected $page;
    protected $orderBy = 'id DESC';

    /**
     * @return mixed
     */
    public function getLimit() {
        return $this->limit;
    }

    /**
     * @param mixed $limit
     */
    public function setLimit($limit) {
        $this->limit = $limit;
    }

    /**
     * @return int
     */
    public function getPageSize() {
        return $this->pageSize;
    }

    /**
     * @param int $pageSize
     */
    public function setPageSize($pageSize) {
        $this->pageSize = $pageSize;
    }

    /**
     * @return int
     */
    public function getPage() {
        return $this->page;
    }

    /**
     * @param int $page
     */
    public function setPage($page) {
        $this->page = $page;
    }

    /**
     * @return string
     */
    public function getOrderBy() {
        return $this->orderBy;
    }

    /**
     * @param string $orderBy
     */
    public function setOrderBy($orderBy) {
        $this->orderBy = $orderBy;
    }


    public function getList() {
        return AdminAccount::find()
            ->where($this->Params)
            ->orderBy($this->orderBy)
            ->offset($this->page)
            ->limit($this->pageSize)
            ->all();
    }

    public function getCount() {
        return AdminAccount::find()
            ->where($this->Params)
            ->count();
    }

    public function getOne() {
        return AdminAccount::findOne($this->Params);
    }
}